home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / mountkernfs.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2008-10-14  |  2KB  |  95 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          mountkernfs
  4. # Required-Start:
  5. # Required-Stop:
  6. # Should-Start:      glibc
  7. # Default-Start:     S
  8. # Default-Stop:
  9. # Short-Description: Mount kernel virtual file systems.
  10. # Description:       Mount initial set of virtual filesystems the kernel
  11. #                    provides and that are required by everything.
  12. ### END INIT INFO
  13.  
  14. PATH=/lib/init:/sbin:/bin
  15. . /lib/init/vars.sh
  16.  
  17. . /lib/lsb/init-functions
  18. . /lib/init/mount-functions.sh
  19.  
  20. [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
  21.  
  22. do_start () {
  23.     #
  24.     # Get some writable area available before the root is checked
  25.     # and remounted.
  26.     #
  27.     RW_OPT=
  28.     [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
  29.     domount tmpfs "" /lib/init/rw tmpfs -omode=0755,nosuid$RW_OPT
  30.     touch /lib/init/rw/.ramfs
  31.  
  32.     # Make pidfile omit directory for sendsigs
  33.     mkdir /lib/init/rw/sendsigs.omit.d/
  34.  
  35.     #
  36.     # Mount proc filesystem on /proc
  37.     #
  38.     domount proc "" /proc proc -onodev,noexec,nosuid
  39.  
  40.     #
  41.     # Mount sysfs on /sys
  42.     #
  43.     # Only mount sysfs if it is supported (kernel >= 2.6)
  44.     if grep -E -qs "sysfs\$" /proc/filesystems
  45.     then
  46.         domount sysfs "" /sys sysfs -onodev,noexec,nosuid
  47.     fi
  48.  
  49.     # Mount /var/run and /var/lock as tmpfs if enabled
  50.     if [ yes = "$RAMRUN" ] ; then
  51.         RUN_OPT=
  52.         [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
  53.         domount tmpfs "" /var/run varrun -omode=0755,nosuid$RUN_OPT
  54.         touch /var/run/.ramfs
  55.     fi
  56.     if [ yes = "$RAMLOCK" ] ; then
  57.         LOCK_OPT=
  58.         [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
  59.         domount tmpfs "" /var/lock varlock -omode=1777,nodev,noexec,nosuid$LOCK_OPT
  60.         touch /var/lock/.ramfs
  61.     fi
  62.  
  63.     # Mount spufs, if Cell Broadband processor is detected
  64.     if [ -d /spu ] && grep -qs '^cpu.*Cell' /proc/cpuinfo; then
  65.             domount spufs "" /spu spufs -ogid=spu
  66.     fi
  67.  
  68.     # Propagate files from the initramfs to our new /var/run.
  69.     for file in /dev/.initramfs/varrun/*; do
  70.         [ -e "$file" ] || continue
  71.         cp -a "$file" "/var/run/${x#/dev/.initramfs/varrun/}"
  72.     done
  73. }
  74.  
  75. case "$1" in
  76.   "")
  77.     echo "Warning: mountkernfs should be called with the 'start' argument." >&2
  78.     do_start
  79.     ;;
  80.   start)
  81.     do_start
  82.     ;;
  83.   restart|reload|force-reload)
  84.     echo "Error: argument '$1' not supported" >&2
  85.     exit 3
  86.     ;;
  87.   stop)
  88.     # No-op
  89.     ;;
  90.   *)
  91.     echo "Usage: mountkernfs [start|stop]" >&2
  92.     exit 3
  93.     ;;
  94. esac
  95.